/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Formas;

import java.awt.Graphics;

/**
 *
 * @author Pedro
 */
public class Linha extends Forma {

    private int proporcao;
    private int inclinacao;
    private int sX1;
    private int sY1;
    
    public Linha(int sX, int sY, int inclinacao, int proporcao)
    {
       super(sX,sY);
       this.inclinacao = inclinacao;
       this.proporcao = proporcao;
       this.sX1 = -1;
       this.sY1 = -1;
    }

    public Linha(int sX, int sY, int inclinacao, int proporcao, int sX1, int sY1)
    {
       this(sX,sY,inclinacao,proporcao);
       this.sX1 = sX1;
       this.sY1 = sY1;
    }

    @Override
    public Forma drawForma(Graphics g) {
        g.setColor(super.getCor());
        if (getsX1() == -1 && getsY1() == -1)
            g.drawLine(super.getsX(), super.getsY(), super.getsX()+(this.getInclinacao()*this.getProporcao()), super.getsY() + (this.getInclinacao()*this.getProporcao()));
        else
            g.drawLine(super.getsX(),super.getsY(),getsX1(), getsY1());
        return this;
    }

    /**
     * @return the proporcao
     */
    public int getProporcao() {
        return proporcao;
    }

    /**
     * @param proporcao the proporcao to set
     */
    public void setProporcao(int proporcao) {
        this.proporcao = proporcao;
    }

    /**
     * @return the inclinacao
     */
    public int getInclinacao() {
        return inclinacao;
    }

    /**
     * @param inclinacao the inclinacao to set
     */
    public void setInclinacao(int inclinacao) {
        this.inclinacao = inclinacao;
    }

    /**
     * @return the sX1
     */
    public int getsX1() {
        return sX1;
    }

    /**
     * @param sX1 the sX1 to set
     */
    public void setsX1(int sX1) {
        this.sX1 = sX1;
    }

    /**
     * @return the sY1
     */
    public int getsY1() {
        return sY1;
    }

    /**
     * @param sY1 the sY1 to set
     */
    public void setsY1(int sY1) {
        this.sY1 = sY1;
    }
}
